﻿_IG_Analytics("UA-1739928-1", "/finance-google-gadget");

var prefs = new _IG_Prefs();

// Initializing tabs
function initTabs() {
		var tabs = new _IG_Tabs();
		// Creating tabs
		tabs.addTab(prefs.getMsg("currencies"), CURRENCY_TAB_ID, displayTabInfo); // displayTabInfo = onSelect Handler
		tabs.addTab(prefs.getMsg("realty"), REALTY_TAB_ID, displayTabInfo);
		tabs.addTab(prefs.getMsg("metals_header"), METAL_TAB_ID, displayTabInfo);
}

function displayTabInfo(tabId) {
		// Deleting loading div from DOM
		var loadingDiv = _gel('loading_div');
		if (loadingDiv != null) {
				loadingDiv.parentNode.removeChild(loadingDiv);
		}

		switch (tabId) {
			case CURRENCY_TAB_ID:
					displayCurrencyInfo();
					break;
			case REALTY_TAB_ID:
					displayRealtyInfo();
					break;
			case METAL_TAB_ID:
					displayMetalInfo();
					break;
		}
}

_IG_RegisterOnloadHandler(initTabs);